home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / aplictns / dtc / part02 < prev    next >
Encoding:
Internet Message Format  |  1990-03-14  |  24.5 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i108: DTC - desktop calendar, Part02/06
  5. Message-ID: <11787@xanth.cs.odu.edu>
  6. Date: 14 Mar 90 01:30:50 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: "Glenn Everhart: 215 354 7610 (8*747 7610)" <EVERHART@ARISIA.dnet.ge.com>
  9. Lines: 1027
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11. X-Mail-Submissions-To: Amiga@cs.odu.edu
  12. X-Post-Discussions-To: comp.sys.amiga
  13.  
  14. Submitted-by: "Glenn Everhart: 215 354 7610 (8*747 7610)" <EVERHART@ARISIA.dnet.ge.com>
  15. Posting-number: Volume 90, Issue 108
  16. Archive-name: applications/dtc/part02
  17.  
  18. #!/bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 2 (of 6)."
  25. # Contents:  Dtc.For.ac
  26. # Wrapped by tadguy@xanth on Tue Mar 13 20:29:22 1990
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'Dtc.For.ac' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Dtc.For.ac'\"
  30. else
  31. echo shar: Extracting \"'Dtc.For.ac'\" \(21940 characters\)
  32. sed "s/^X//" >'Dtc.For.ac' <<'END_OF_FILE'
  33. X          itx1 = it1
  34. X          itx2 = it2
  35. X
  36. X      End If
  37. X
  38. X      call shrink (1, ifnb, lnb)
  39. X
  40. X      if (ifnb .eq. 0) then
  41. X          if (idisp .eq. idspp) then
  42. X        call dtcidate(im,id,iye)
  43. XC set to today's date
  44. X          else
  45. X        go to 999
  46. XC Not enough info for U or X
  47. X          end if
  48. X      else
  49. XC               If the date was specified in command line then
  50. Xc               set id, im and iye to the right values:
  51. Xc
  52. X 10         call dtcdatcvt(3)
  53. XC (line)
  54. X
  55. X          if (first) then
  56. XC Note we decode into
  57. X        im = idmo
  58. XC second set of values,
  59. X        id = iddy
  60. XC then copy into first set
  61. X        iye = ibigyr
  62. XC first (or only) time around
  63. X          end if
  64. XC (unlike Schlitz, we can go around twice)
  65. X
  66. X          if (idisp .ne. idspp) then
  67. XC other than purge
  68. Xc ***           itx2 = 175
  69. XC Set default for '*' or <null>
  70. X        call dtctimcvt(itx1, itx2)
  71. X        if (itx1 .eq. itx2)
  72. X     1      itx2 = itx2 + 1
  73. XC Add (10 mins) to allow semi-open interval
  74. X        if (first) then
  75. X            it1 = itx1
  76. X            it2 = itx2
  77. X            if (idisp .eq. idspx) then
  78. X                if (ln1 .eq. 0) go to 999
  79. XC Error if nothing left
  80. X                first = .false.
  81. X                go to 10
  82. XC Re-cycle code
  83. X            end if
  84. XC Done unless X
  85. X        end if
  86. X          else
  87. XC P, guarantee no redisplay
  88. X        ln1 = 0
  89. XC Zap the line
  90. X          end if
  91. XC Done parse for U, X
  92. X      end if
  93. XC Done date/time parse
  94. X
  95. X      ixhash = ihymd(iye, im, id)
  96. XC Calc hash for day of interest
  97. X
  98. Xc ***   type 950, ixhash
  99. Xc *** 950       format(2z9.8)
  100. X
  101. X      if (idisp .eq. idspp)
  102. X     1 then
  103. XC Set request date for RDAPPT
  104. X          irqhash(1) = ixhash
  105. XC Delete before
  106. X        else
  107. X          irqhash(1) = 0
  108. XC Look at everybody
  109. X      end if
  110. X
  111. X      irqhash(2) = Z'7FFFFFFF'
  112. XC 'Til the end of time
  113. X
  114. X      firstflg = 0
  115. XC Zero until file opened for write
  116. X
  117. X      prveof = 0
  118. X      eofflg = -1
  119. X
  120. X      do while (prveof .ge. 0)
  121. X
  122. X          call dtcrdappt(eofflg, 1)
  123. XC Look at control entries
  124. X
  125. X          if (eofflg .gt. 0)
  126. X     1     then
  127. X        eofflg = 0
  128. XC Don't open it on return
  129. X        go to 190
  130. XC but re-write it as is
  131. X
  132. XC Test it now
  133. X          else if (eofflg .eq. 0)
  134. X     1     then
  135. X
  136. Xc ***   type 950, irchash
  137. X
  138. X        iht = min0(max0(iht, 80), 173)
  139. XC Insure a kosher time value
  140. X
  141. X        go to (110, 120, 130) idisp
  142. XC Dispatch on numeric value
  143. X        go to 190
  144. XC Bad call, re-write anyway?
  145. X
  146. X 120            if ((irchash .eq. ixhash) .and.
  147. X     1      ((iht .ge. it1) .and. (iht .lt. it2)))
  148. X     2      go to 100
  149. XC Criteria for Unscheduling (deleting)
  150. X        go to 190
  151. XC Do re-write
  152. X
  153. X 130            if ((irchash .eq. ixhash) .and.
  154. X     1      ((iht .ge. it1) .and. (iht .lt. it2)))
  155. X     2    then
  156. X
  157. X            iht = itx1 + (iht - it1)
  158. XC Get updated time
  159. X            if (mod(iht, 10) .eq. 6) iht = iht + 4
  160. XC go to next hour
  161. X
  162. X            if (iht .gt. itx2) go to 100
  163. XC Duration was shortened
  164. X
  165. X            ihy = ibigyr
  166. XC Change dates
  167. X            ihm = idmo
  168. X            ihd = iddy
  169. X
  170. X        end if
  171. XC Usually re-write
  172. Xc
  173. X 110            continue
  174. XC Purge, re-write
  175. X
  176. XC Can't open output till
  177. X 190            if (firstflg .eq. 0)
  178. X     1    then
  179. XC we have input
  180. XC
  181. X
  182. X            close(3)
  183. Xc            open(unit=3, file=FNc(1:fnsz), status='NEW',
  184. Xc     1          form='FORMATTED',
  185. Xc     1          err=999)
  186. X9991    continue
  187. X            open(unit=3, file='DTC.TMP', status='NEW',
  188. X     1          form='FORMATTED',
  189. X     1          err=999)
  190. X      iopn2=1
  191. Xc flag we got DTC.TMP open...
  192. X            firstflg = 1
  193. XC Output now open
  194. X
  195. X        end if
  196. X
  197. X        write (3, 201,err=9991) ihy, ihm, ihd, iht,
  198. X     1          apptstr(1:min0(max0(iaptln, 1), iaptlim))
  199. Xc ***   1         (appoin(k), k=1, min0(max0(iaptln, 1), iaptlim))
  200. X 201            format(i4.4, 2i2.2, i3.3, x, a)
  201. XC New format, 19850806113
  202. X
  203. X          end if
  204. XC eofflg
  205. X
  206. X 100        prveof = eofflg
  207. XC Set loop condition
  208. X
  209. X      end do
  210. XC while
  211. X
  212. XC Purged everything?
  213. X      if (firstflg .eq. 0)
  214. X     1 then
  215. XC create empty file
  216. X
  217. X          close(3)
  218. Xc          open(unit=3, file=FNc(1:fnsz), status='NEW',
  219. Xc     1  form='FORMATTED',
  220. Xc     1  err=999)
  221. X          open(unit=3, file='DTC.TMP', status='NEW',
  222. X     1  form='FORMATTED',
  223. X     1  err=999)
  224. X          iopn2=1
  225. X          firstflg = 1
  226. XC Output now open
  227. X
  228. X       end if
  229. X
  230. X    if(iopn2.le.0)goto 9403
  231. Xc Amiga ...
  232. Xc rewind 1 and 2, then copy DTC.TMP into DTC.DAT (or wherever)
  233. Xc    Rewind 1
  234. X        close(1)
  235. X        close(4)
  236. X        open(unit=4, file=FNc(1:fnsz), status='NEW',
  237. X     1  form='FORMATTED',err=999)
  238. Xc re-open unit 4 if we can, for write...
  239. Xc    Rewind 3
  240. X          close(3)
  241. X          open(unit=3, file='DTC.TMP', status='old',
  242. X     1  form='FORMATTED',
  243. X     1  err=999)
  244. X
  245. X9402    continue
  246. X    Read (3,201,end=9401,err=9401) ihy,ihm,ihd,iht,apptstr
  247. Xc read temp file, write back new appt file
  248. X        write (4, 201,err=9401) ihy, ihm, ihd, iht, apptstr
  249. Xc 201            format(i4.4, 2i2.2, i3.3, x, a)
  250. X    goto 9402
  251. X9401    continue
  252. X    close(3,Status='delete')
  253. X        close(4)
  254. X        firstflg=0
  255. X        iopn2=0
  256. X9403    continue
  257. X        close(3)
  258. X        close(2)
  259. X        close(4)
  260. X        close(1)
  261. XC Done with new files
  262. X
  263. X        return
  264. X
  265. X 999    write (iterm, 990)
  266. XC Error on decode, write nastygram
  267. X 990    format($,'Syntax or file-open (write) error.', $)
  268. X       ln1 = 0
  269. XC Inhibit rescan
  270. Xc
  271. X      end
  272. XC -h- dtcdatcvt.for       Tue Jul  8 16:07:21 1986
  273. Xc Date conversion function (part of DTC), derived from DATMUN,
  274. Xc except decodes the values directly into DEFDAT and shrinks LINE,
  275. Xc rather than schlep LINE back and forth to kingdom come.
  276. XC Modified 850422, CG, to restrict values of month/day/year
  277. XC modified 850325, 850726 & 850731, CG, to allow any of the following:
  278. Xc       d{d}/m{m}/{y}y, d, dd, dmm, ddmm, dmmyy, ddmmyy, dmmyyyy, ddmmyyyy
  279. Xc                                                       for D or W functions
  280. Xc       m{m}/{y}y, m, mm, myy, mmyy, mmyyyy, myyyy      for M
  281. Xc       y, yy, yyy, yyyy                                for Y
  282. XC plus dd-mon-yy, dd-mm-yy, dd-xii-yy formats
  283. XC function:
  284. Xc  Convert a line starting with a date of form
  285. Xc       mmddyy OR mm/dd/yy OR dd-mon-yy OR dd-romn-yy
  286. Xc  to binary equivalents, and remove from line, copying binary values
  287. Xc  to DEFDAT in common.
  288. XC  Leaves whatever follows the date alone.
  289. Xc  Added for DTC to not have to use such a crock date
  290. Xc  format as the original; too hard to use otherwise.
  291. X
  292. X      Subroutine dtcdatcvt (nf)
  293. XC (line,nf)
  294. Xc
  295. Xc      implicit none
  296. Xc
  297. X      Integer*4  nf
  298. XC Number of fields expected
  299. Xc
  300. X      include comdtc.INC
  301. Xc
  302. X      INTEGER*1 nb, l1, l2, l3, l4, lxx(4), work(icmln), tb6(6)
  303. XC,
  304. Xc
  305. XC lengths of months (30 days hath Sept ...)
  306. X      Integer*4 lm(12)
  307. Xc
  308. XC Min chars to recognize month names
  309. X      Integer*4 minln(12)
  310. X
  311. XC Decode month names, or European style w/ Roman months
  312. X      character*4 rch,mab(12),rom(12)
  313. X
  314. X      Integer*4 i, k, kkk, n, nn, ix, ixyr, ixmo, ixdy, nfd,
  315. X     1  ifnb, lnb, lcount
  316. X
  317. X      logical longyr
  318. XC If year entered as 3 chars or more
  319. X
  320. X      integer*2 iwk(42), lw1
  321. X      integer*1 iwkk(84),ln1
  322. X      Character*1 ln1c
  323. X      Equivalence (work,iwkk)
  324. XC 2 chars at a time
  325. Xc
  326. X      Integer*4  ll1
  327. X
  328. X      equivalence(line(1),ln1)
  329. X      equivalence (ln1,lw1),(ll1,rch)
  330. X      equivalence (rch, lxx), (work, iwk)
  331. X      equivalence(line(1),ln1c)
  332. Xc
  333. X      Integer*4 icvt10, icur
  334. X      INTEGER*1 ich
  335. X      include stmtfuncsp.for
  336. X      include comdtcd.inc
  337. X
  338. X      Data lm
  339. X     1 /31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31/
  340. Xc
  341. XC Min chars to recognize month names
  342. X       Data minln
  343. X     1 /2, 1, 3, 2, 3, 3, 3, 2, 1, 1, 1, 1/
  344. X
  345. XC Decode month names, or European style w/ Roman months
  346. X      Data
  347. X     1 mab / 'JANU', 'FEBR', 'MARC', 'APRI', 'MAY ', 'JUNE',
  348. X     2      'JULY', 'AUGU', 'SEPT', 'OCTO', 'NOVE', 'DECE'/,
  349. X     3 rom / 'I   ', 'II  ', 'III ', 'IV  ', 'V   ', 'VI  ',
  350. X     4      'VII ', 'VIII', 'IX  ', 'X   ', 'XI  ', 'XII '/
  351. X
  352. X       include stmtfunc.for
  353. X      icvt10(icur, ich) = (icur * 10) + icvtbn1(ich)
  354. XC conversion function stage
  355. X
  356. Xc Begin code
  357. X
  358. X      longyr = .false.
  359. XC set default of century calculation
  360. X
  361. Xc Initialize default values for omitted fields
  362. X
  363. X      ixyr = ibigyr
  364. XC Copy current values
  365. X      ixmo = idmo
  366. XC from common
  367. X      ixdy = iddy
  368. X      if (numeric(ln1)) then
  369. XC Dates must start with number
  370. X
  371. X          work(1) = ln1
  372. XC Copy first character
  373. X          ix = icvtbn1(ln1)
  374. XC Compute value on the fly
  375. Xc
  376. X          do (n = 2, (nf * 2) + 2)
  377. XC Allow [mm][dd][yyyy]
  378. Xc
  379. X        l1 = line(n)
  380. XC Copy current character
  381. X
  382. XC Field separators: slash
  383. X        if (l1 .eq. ichar('/'))
  384. X     1      go to 100
  385. XC for mm/dd/yy form
  386. X
  387. XC .. dash
  388. X        if (l1 .eq. ichar('-'))
  389. X     1      go to 200
  390. XC for dd-mmm-yy form
  391. X
  392. X        if ((l1 .eq. ichar(':')) .or. (l1 .eq.ichar('>')))
  393. X     1      go to 999
  394. XC hour-string first, return default values
  395. XC anything else:
  396. X        if (.not. numeric(l1))
  397. X     1      go to 300    
  398. XC mmddyy, minus some characters, fake whatever is required
  399. X
  400. X        work(n) = l1
  401. XC Don't recopy
  402. X        ix = icvt10(ix, l1)
  403. XC continue conversion
  404. X
  405. X          end do
  406. X
  407. X          n = (nf * 2) + 3
  408. XC Set shrink value if no delimiter
  409. X
  410. X          go to 300
  411. XC Go convert it
  412. X
  413. X      else if ((ln1c .eq. '+') .or. (ln1c .eq. '-')) then
  414. X          k = incmod
  415. XC Save current value
  416. X          call dtcdatinc
  417. XC Convert incremental date
  418. X          incmod = k
  419. XC Restore
  420. X      else if (ln1c .eq. '=') then
  421. X          kkk = 1
  422. XC Place holder, strip only, date n/c
  423. X          go to 950
  424. X      end if
  425. XC (don't want to reformat whole file)
  426. X
  427. X      go to 999
  428. XC All done here
  429. X
  430. Xc handle mm/dd or mm/dd/yy{yy} (for D, W, M or Y)
  431. Xc or mm/yy{yy} (for M or Y)
  432. X
  433. X 100    continue
  434. XC Here for '/' encountered in first scan loop
  435. X
  436. X      k = n + 1
  437. XC next character to look at
  438. X      l1 = line(k)
  439. X      if (.not. numeric(l1)) go to 300
  440. XC nnnn/x ???
  441. X
  442. X      ixmo = ix
  443. XC First field is always month in "/" notation
  444. X
  445. X      ix = icvtbn1(l1)
  446. XC Start 2nd conversion
  447. X
  448. X      do (n = k + 1, 20)
  449. XC should be plenty
  450. X
  451. X          l1 = line(n)
  452. XC get character
  453. X          if (l1 .eq. ichar('/')) go to 110
  454. XC Found second /
  455. X          if (.not. numeric(l1)) go to 120
  456. XC End of scan
  457. X          ix = icvt10(ix, l1)
  458. XC convert
  459. X
  460. X      end do
  461. X
  462. X      n = 21
  463. XC Set it
  464. X
  465. X 120    if (nf .eq. 3) then
  466. X          ixdy = ix
  467. XC 2nd field is day
  468. X      else
  469. X          ixyr = ix
  470. XC .. year
  471. X          longyr = ((n - k) .gt. 2)
  472. X      end if
  473. X
  474. X      go to 900
  475. X
  476. X 110    l1 = line(n+1)
  477. XC Found 2nd slash, check for third field
  478. X      if (.not. numeric(l1)) go to 120
  479. XC left field
  480. XC
  481. X
  482. X      k = n + 1
  483. X
  484. X      ixdy = ix
  485. XC 2nd has to be day
  486. X
  487. X      ixyr = icvtbn1(l1)
  488. XC Start 3rd conversion (year)
  489. X
  490. X      do (n = k + 1, 20)
  491. XC get more numerics
  492. X
  493. X          l1 = line(n)
  494. X          if (.not. numeric(l1)) go to 910
  495. X          ixyr = icvt10(ixyr, l1)
  496. X
  497. X      end do
  498. X
  499. X      n = 21
  500. XC mark next character
  501. X
  502. X      go to 910
  503. XC set for SHRINK
  504. X
  505. Xc handle dd-mon-yy, dd-mm-yy, or dd-roman-yy
  506. X
  507. X 200    continue
  508. XC Here for '-' in first scan loop
  509. X
  510. X      ixdy = ix
  511. XC Copy converted day field
  512. X
  513. X      rch = '    '
  514. XC initialize for alpha month name, or Roman numerals
  515. X
  516. X      k = n + 1
  517. XC next char after "-"
  518. X
  519. X      l1 = line(k)
  520. X
  521. X      if (numeric(l1)) then
  522. XC European format dd-mm-yy
  523. X
  524. X          ixmo = icvtbn1(l1)
  525. XC go for it directly
  526. X
  527. X          do (n = k + 1, 20)
  528. X
  529. X        l1 = line(n)
  530. X
  531. X        if (.not. numeric(l1)) go to 210
  532. X
  533. X        ixmo = icvt10(ixmo, l1)
  534. X
  535. X          end do
  536. X
  537. X          n = 21
  538. X
  539. X      else if (alpha(l1)) then
  540. X
  541. X          lxx(1) = l1 .and. z'5F5f5f5f'
  542. XC Set first char for name or roman
  543. X
  544. X          lcount = 1
  545. X
  546. X          do (nn = k + 1, k + 6)
  547. XC should find "-" by then
  548. X
  549. X        l1 = line(nn)
  550. X        if (l1 .eq. ichar('-')) go to 230
  551. XC Start search
  552. X        if (.not. alpha(l1)) go to 230
  553. XC also terminate
  554. X        if (lcount .lt. 4) then
  555. XC room for at least one more
  556. X            lcount = lcount + 1
  557. X            lxx(lcount) = l1 .and. z'5F5f5f5f'
  558. XC Copy character
  559. X        end if
  560. X          end do
  561. X
  562. X          nn = k + 6
  563. X
  564. X 230        continue
  565. X
  566. X          do (i = 1, 12)
  567. XC Loop over months
  568. X        if (rch .eq. rom(i)) go to 250
  569. XC Found match in roman set
  570. X        if (lcount .ge. minln(i)) then
  571. X            if (rch(1:lcount) .eq. mab(i)(1:lcount))
  572. X     1          go to 250
  573. XC Found match in alpha names
  574. X        end if
  575. X
  576. XC Note: last two IF statements above replace original horrendous sequence of
  577. Xc IF-THEN-ELSEs to see if month was J then A, or F, or M then A then R, etc
  578. XC
  579. X         end do
  580. X
  581. Xc Fell out of loop, leave current month
  582. X
  583. X          go to 300
  584. XC Unknown month or roman seq, back up before "-"
  585. X
  586. X 250        ixmo = i
  587. XC iwk(1) = icvtbcd(i)
  588. X          n = nn
  589. XC Accept characters
  590. X
  591. X      else
  592. XC "-" followed by non alphanumeric
  593. X          go to 300
  594. X      end if
  595. X
  596. X 210    if (l1 .ne. ichar('-')) go to 900
  597. XC See if year follows
  598. X
  599. X      k = n + 1
  600. X      l1 = line (k)
  601. X
  602. X      if (.not. numeric(l1)) go to 910
  603. XC First dash is left
  604. X      ixyr = icvtbn1(l1)
  605. X
  606. X      do (n = k + 1, 30)
  607. X
  608. X          l1 = line (n)
  609. X
  610. X          if (.not. numeric(l1)) go to 910
  611. X
  612. X          ixyr = icvt10(ixyr, l1)
  613. X
  614. X      end do
  615. X
  616. X      n = 31
  617. X
  618. X 910    longyr = ((n - k) .gt. 2)
  619. XC Set logic value
  620. X
  621. X      go to 900
  622. X
  623. X300      continue
  624. XC Short string found, fix it up
  625. X
  626. X      nfd = n/2
  627. XC Number of 2-char groups found
  628. X
  629. X      longyr = (nfd .gt. nf)
  630. XC check for default or forced century
  631. X
  632. X      if ((n .and. 1) .eq. 0) then
  633. XC Example: n = 5 for 4 chars found (0 mod 2)
  634. X          work(1) = '0'
  635. XC Force even number of characters
  636. X          do (i = 2, n)
  637. X        work(i) = line(i - 1)
  638. XC Shift line over by 1
  639. X          end do
  640. X      end if
  641. X
  642. X      go to (310, 320, 330) nf
  643. XC Dispatch on # expected fields
  644. X      go to 900
  645. XC Bad value ???
  646. X
  647. X 310    ixyr = ix
  648. XC take year: Y [yy]
  649. X      go to 900
  650. XC End case
  651. X
  652. X 320    ixmo = icvtbin(iwkk(1))
  653. XC M mm
  654. X      if (nfd .eq. 2) ixyr = icvtbin(iwkk(3))
  655. XC M {m}myy
  656. X      if (nfd .eq. 3) ixyr = mod(ix, 10000)
  657. XC M {m}myyyy
  658. X      go to 900
  659. XC End case
  660. X
  661. X 330    if (nfd .eq. 1) ixdy = icvtbin(iwkk(1))
  662. XC D {d}d {only}
  663. X
  664. X      if (nfd .ge. 2) then
  665. XC D [mm]dd[yy]
  666. X          ixmo = icvtbin(iwkk(1))
  667. XC D {m}mdd
  668. X          ixdy = icvtbin(iwkk(3))
  669. XC D {m}mdd
  670. X      end if
  671. X
  672. X      if (nfd .eq. 3) ixyr = icvtbin(iwkk(5))
  673. XC D {m}mddyy
  674. X      if (nfd .eq. 4) ixyr = mod(ix, 10000)
  675. XC D {m}mddyyyy
  676. X
  677. X 900    continue
  678. XC common clean-up & return
  679. X
  680. XC Check for 1-99 AD
  681. X      if ((ixyr .lt. 100) .and. (.not. longyr))
  682. X     1   ixyr = ixyr + ((ibigyr/100)*100)
  683. XC add "current" century
  684. X
  685. X      if (islpyr(ixyr))
  686. X     1 then
  687. X          lm(2) = 29
  688. XC Set for Leap Years
  689. X        else
  690. X          lm(2) = 28
  691. XC reset for "common" years
  692. X      end if
  693. X
  694. X      ibigyr = ixyr
  695. XC Explicit year
  696. X      idmo = min0(max0(ixmo, 1), 12)
  697. XC Limit values
  698. X      iddy = min0(max0(ixdy, 1), lm(idmo))
  699. XC ..
  700. X
  701. X      kkk = n - 1
  702. XC Change index of next char to count
  703. X
  704. X 950    idyr = mod(ibigyr, 100)
  705. XC Set value
  706. X
  707. X      if (kkk .gt. 0)
  708. X     1 call shrink (kkk, ifnb, lnb)
  709. XC Unload the stuff we used
  710. X
  711. X 999    return
  712. XC Miscellaneous exits
  713. X       end
  714. Xc -h- dtctimcvt.for       Tue Jul  8 16:08:13 1986
  715. Xc Subroutine to extract and convert time-of-day string for DTC package
  716. Xc Converts string of form hh:mm to Integer*4 between 80 and 173
  717. Xc (half-hour intervals).  If range h1:m1>h2:m2 is present, second
  718. Xc value is returned, else same as t1>t1.
  719. X
  720. Xc Special cases
  721. Xc       *       =>      {itr1}>{itr2}
  722. Xc       E or EV =>      17:00
  723. Xc       h:      =>      0h:00
  724. Xc       h:n     =>      0h:n0   (if n .ge. 3, then 3, else 0)
  725. Xc       h1>h2   =>      h1:00>h2:00
  726. X
  727. Xc If ':' or '>' is not 2nd or 3rd character, or not '*', 'E' or 'EV',
  728. Xc entire string is left untouched, and default values are returned
  729. Xc (parameters unchanged)
  730. X
  731. X      subroutine dtctimcvt (itr1, itr2)
  732. X
  733. X      include comdtc.INC
  734. X
  735. X      INTEGER*1 ll, ln1, wk(2)
  736. X      integer*2 iwk
  737. X      character*2 icwk
  738. X      equivalence(icwk,iwk)
  739. X      integer*1 iwkk
  740. X      logical first, expectmin
  741. X
  742. X      equivalence (line(1), ln1), (iwk, wk)
  743. X      equivalence(iwkk,wk(1))
  744. X      include stmtfuncsp.for
  745. X      include comdtcd.inc
  746. X      include stmtfunc.for
  747. X
  748. X      it1 = itr1
  749. XC Caller's limits
  750. X      it2 = itr2
  751. XC (formerly 8:00 AM > 5:30 PM)
  752. X
  753. X      ix = 0
  754. XC Amount to strip
  755. X      if(ln1.gt.96)ln1=ln1-32
  756. X      if (ln1 .eq. ichar('*')) then
  757. XC Check special cases first
  758. X
  759. X          ix = 1
  760. XC Defaults, dump 1 char
  761. X
  762. X      else if ((ln1 ) .eq. ichar('E')) then
  763. X
  764. X          it1 = 170
  765. XC Set eventide
  766. X          it2 = it1
  767. X
  768. X          ix = 1
  769. X          if(line(2).gt.96)line(2)=line(2)-32
  770. X          if ((line(2)) .eq. ichar('V')) ix = 2
  771. X
  772. X      else
  773. X
  774. X          i = 0
  775. XC Temp index
  776. X          first = .true.
  777. XC Helpful
  778. X
  779. X 10         if (numeric(line(i+1))) then
  780. X
  781. X        if (numeric(line(i+2))) then
  782. X            wk(1) = line(i+1)
  783. X            wk(2) = line(i+2)
  784. X            read(icwk,850)ih
  785. X850     format(BZ ,I2)
  786. X            ih=ih*10
  787. Xc            ih = icvtbin(iwkk) * 10
  788. X            i = i + 2
  789. X        else
  790. X            ih = icvtbn1(line(i+1)) * 10
  791. X            i = i + 1
  792. X        end if
  793. X
  794. X        if (line(i+1) .eq. ichar(':')) then
  795. X            i = i + 1
  796. X            if (numeric(line(i+1))) then
  797. X                im = icvtbn1(line(i+1))
  798. X                if (im .ge. 3) then
  799. X                    im = 3
  800. X                else
  801. X                    im = 0
  802. X                end if
  803. X                ih = ih + im
  804. X                i = i + 1
  805. X                if (numeric(line(i+1))) i = i + 1
  806. XC Just ignore it
  807. X            end if
  808. X            ix = i
  809. XC Accept all processed chars
  810. X        end if
  811. X
  812. X        if ((ih .ge. 10) .and. (ih .lt. 70))
  813. X     1     ih = ih + 120
  814. XC Force early AM to PM
  815. X        ih = min0(max0(ih, 80), 180)
  816. XC Normalize within limits
  817. X
  818. X        if (line(i+1) .eq. ichar('>')) then
  819. X            i = i + 1
  820. X            ix = i
  821. XC Insure it gets copied
  822. X            it2 = ih
  823. X            if (first) then
  824. X                it1 = it2
  825. X                first = .false.
  826. X                go to 10
  827. X            end if
  828. X        else if (ix .ne. 0)     then
  829. XC Got some numeric
  830. X            if (first) then
  831. X                it1 = ih
  832. XC terminated by ':'
  833. X                it2 = ih
  834. XC first time t1>t1
  835. X            else
  836. X                it2 = ih
  837. XC 2nd numeric
  838. X                ix = i
  839. XC Claim everything looked at
  840. X            end if
  841. XC Which time
  842. X        end if
  843. XC Range delimiter ('>')
  844. X          end if
  845. XC First numeric
  846. X      end if
  847. XC All others unrecognized (includes EOL)
  848. X
  849. X      itr1 = it1
  850. XC All exit here
  851. X      itr2 = max0(it2, it1)
  852. XC Make sure range OK
  853. X
  854. X      if (ix .ne. 0) call shrink (ix, ifnb, lnb)
  855. XC Unload what we've used
  856. X
  857. X      end
  858. XC -h- shrink.for  Tue Jul  8 16:08:41 1986
  859. Xc Subroutine to shift LINE to left after current item has been scanned
  860. Xc deletes blanks between that point and first non-blank character
  861. Xc Performs no operation if current item is EOL (binary 0)
  862. X
  863. Xc Sets return arguments pointing to first and last non-blank characters
  864. X
  865. X      subroutine shrink (iskip, ifnbr, lnbr)
  866. Xc
  867. X      include comdtc.INC
  868. X
  869. X      INTEGER*1 ll
  870. X      include comdtcd.inc
  871. X
  872. X      ifnb = 0
  873. X      lnb = 0
  874. X
  875. X      if (line(1) .eq. 0) go to 999
  876. XC Exit immediately
  877. X
  878. X      ix = iskip + 1
  879. XC start looking
  880. X      do while ((ix .le. icmln) .and. (line(ix) .ne. 0))
  881. X      if (line(ix) .gt. 32) go to 10
  882. XC Found something
  883. X      ix = ix + 1
  884. X      end do
  885. X      line(1) = 0
  886. XC Flag end, no copy
  887. X      go to 999
  888. X
  889. X 10     ifnb = 1
  890. X      lnb = 1
  891. X
  892. X      Do (i = 1, icmln-ix)
  893. X
  894. X          ll = line(ix)
  895. X          line(i) = ll
  896. X          if (ll .eq. 0) go to 999
  897. XC Stop at EOL
  898. X          if (ll .gt. 32) lnb = i
  899. X          ix = ix + 1
  900. X      end do
  901. X      line(min0(lnb+1, icmln)) = 0
  902. XC Flag EOL if not found
  903. X
  904. X 999    ifnbr = ifnb
  905. XC Set return values
  906. X      lnbr = lnb
  907. X
  908. X      end
  909. XC -h- dtcat.for   Tue Jul  8 16:09:05 1986
  910. X      subroutine dtcat(ic,ir)
  911. XC x, y
  912. Xc
  913. X      include comdtc.INC
  914. XC Need ITERM
  915. X      include escdtc.INC
  916. XC
  917. X      include comdtcd.inc
  918. X      include escdtcd.inc
  919. X      write(iterm,773)
  920. X773   format(' ')
  921. Xc write once to flush extra junk out... then position.
  922. X      write(iterm, 2, err=3) esc,'[',ir,';',ic,'H'
  923. X 2      format($,2a1,i2.2,a1,i3.3,a1,$)
  924. XC Max rows is 2-digit number
  925. Xc
  926. X      return
  927. Xc
  928. X 3      write (iterm,10) esc,homescrn, ir, ic
  929. X 10     format($, 2a, 'Error in DTCAT, row/col =', 2z5.4, ' (hex).')
  930. X      end
  931. XC -h- gaby.for    Tue Jul  8 16:10:23 1986
  932. Xc-----------------------------------------------------------------------
  933. XC       Subroutine Gaby
  934. XC       Part of Mitch Wyle's DTC program
  935. XC       return a string corresponding to the month number
  936. Xc       Month number contained in im.  Send back string in monthn.
  937. Xc       (JANUARY for 1, etc.)
  938. XC-----------------------------------------------------------------------
  939. XC       modified 850315 - Center month names in table, use mixed case - CG
  940. X
  941. X      SUBROUTINE gaby(im,monthn)
  942. X
  943. XC       Declarations:
  944. Xc
  945. X      INTEGER*1 monthn(9)
  946. XC       Table of month names and numbers (centered, even lengths biased left):
  947. Xc
  948. X
  949. X      INTEGER*1 months(9,14)
  950. X      character*9 monthch(14)
  951. X
  952. X      equivalence (months, monthch)
  953. XC       Select the right month and fill monthn with it:
  954. Xc
  955. X      Data monthch/           'December ',
  956. X     1 ' January ', 'February ', '  March  ', '  April  ',
  957. X     2 '   May   ', '  June   ', '  July   ', ' August  ',
  958. X     3 'September', ' October ', 'November ', 'December ',
  959. X     4 ' January '/
  960. X
  961. X
  962. XC ALLOW FOR OVERFLOWS...
  963. X      IMM=IM+1
  964. Xc ***   monthn = monthch(imm)
  965. XC String assignment
  966. Xc
  967. X      Do 1 i=1,9
  968. XC INTEGER*1-at-a-time
  969. X          Monthn(i) = months(i,imm)
  970. X 1      Continue
  971. X
  972. Xc       All done.
  973. X
  974. X      return
  975. X      end
  976. Xc -h- ICVT routines
  977. X       Integer*2 function Icvtbin(ich2)
  978. X       Character*2 ich2
  979. X       Character*2 wrk
  980. X       integer*2 iwrk,ians
  981. X       Equivalence(wrk,iwrk)
  982. Xc convert 2 digit Integer*4 to number
  983. Xc avoid trick version from VAX that depends on byte
  984. Xc ordering (which fails on MC68000).
  985. X       wrk=ich2
  986. X       Read(wrk,1,err=2)ians
  987. X1      Format(BN,I2)
  988. X2      Continue
  989. X       Icvtbin=ians
  990. X       Return
  991. X       End
  992. X       Function Icvtbn1(nnn)
  993. X       Integer*1 nnn
  994. X       Integer*4  kkk
  995. X       kkk=48
  996. X       if(nnn.ge.48.and.nnn.le.57)kkk=nnn
  997. X       kkk=kkk-48
  998. Xc return 0 or digit value...
  999. X       Icvtbn1=kkk
  1000. X       Return
  1001. X       End
  1002. Xd       subroutine dely
  1003. Xd       Integer*4 idly,i1
  1004. Xd       common/xxxyyy/idly
  1005. Xd       idly=0
  1006. Xd       do 1 i1=1,15000
  1007. Xd       idly=idly+i1
  1008. Xd1      continue
  1009. Xd       idly=idly/100
  1010. Xd       return
  1011. Xd       end
  1012. X
  1013. X
  1014. END_OF_FILE
  1015. if test 21940 -ne `wc -c <'Dtc.For.ac'`; then
  1016.     echo shar: \"'Dtc.For.ac'\" unpacked with wrong size!
  1017. fi
  1018. # end of 'Dtc.For.ac'
  1019. fi
  1020. echo shar: End of archive 2 \(of 6\).
  1021. cp /dev/null ark2isdone
  1022. MISSING=""
  1023. for I in 1 2 3 4 5 6 ; do
  1024.     if test ! -f ark${I}isdone ; then
  1025.     MISSING="${MISSING} ${I}"
  1026.     fi
  1027. done
  1028. if test "${MISSING}" = "" ; then
  1029.     echo You have unpacked all 6 archives.
  1030.     rm -f ark[1-9]isdone
  1031. else
  1032.     echo You still need to unpack the following archives:
  1033.     echo "        " ${MISSING}
  1034. fi
  1035. ##  End of shell archive.
  1036. exit 0
  1037. -- 
  1038. Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
  1039. Mail comments to the moderator at <amiga-request@cs.odu.edu>.
  1040. Post requests for sources, and general discussion to comp.sys.amiga.
  1041.